package webservices;

import java.util.ArrayList;

import javax.jws.WebService;

@WebService(endpointInterface= "webservices.IConnectionWSD")
public class ConnectionObject implements IConnectionWSD{

	public static final String URIServeur= "tcp://localhost:61616";
	public static final String SessionName= "chat.queue";
	private final ArrayList<String> listUsers= new ArrayList<String>();
 	
	public String[] connect(String login) {
		if(listUsers.contains(login)){
			String [] result= {"error pseudonyme"};
			return result;
		}else{
			listUsers.add(login);
			String[] infoConnection = {URIServeur, SessionName};
			return infoConnection;
		}
	}
	
	public boolean deconnection(String login){
		return listUsers.remove(login);
	}
	
	
}